Move confirmation prompt to a static function #21006
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is an alternative to #21003 and a follow up of #21003 (comment).
Relates to #20994.
When the user wants to change their username from
ChangeUsernameViewController
, the app shows a confirmation alert which has a text field to ask the user to type the new username. The confirmation button in the alert will be disabled first and turn into enabled only when the user types the new username correctly.Current implementation adds notification observer at the time of creating the alert and unregisters the observer when alert is dismissed. There are a few issues with current implementation, I'll post an inline comments to highlight them. This PR refactors the observing notification approach to register an observer once the view controller is loaded and let iOS SDK to unregister it when the view controller is released.
Test Instructions
editableUsername
, so that we can enter the "change username" screen.The "Change username" alert button should be disabled. The button should become enabled when the text in the text field matches the new username, and should become disable if it doesn't.
Regression Notes
Potential unintended areas of impact
None.
What I did to test those areas of impact (or what existing automated tests I relied on)
What's described in the test instruction section.
What automated tests I added (or what prevented me from doing so)
None.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.UI Changes testing checklist: N/A